/**
 * Created by weiqing on 2017/1/19.
 */

jQuery(".slideBox").slide({mainCell:".bd ul",autoPlay:true});
$(function(){

    /*alert(document.body.clientwidth);*/

    //顶部横幅点击消失
    $(".event i").click(function(){
            $(this).parent().fadeOut();
    })

    //右侧小公告切换
    $(".infoitem").eq(0).show();
    $(".i_tit").hover(function(){
            var index = $(this).index();
            if(index==1){
                $(".i_line").animate({
                    "left":"35px"
                },150)
            }else{
                $(".i_line").animate({
                    "left":"-10px"
                },150)
            }
            $(".infoitem").hide();
            $(".infoitem").eq(index).show();

        })


    //轮播图
    jQuery(".inBox").slide({ titCell:".inHd li",mainCell:".inBd" ,effect:"top"});
    jQuery(".outBox").slide({ effect:"left" });

    //tab切换
    $(".ft_page>div").eq(0).show();
    $(".ft_title>a").hover(function(){
        var index=$(this).index();
        $(".ft_page>div").hide();
        $(".ft_page>div").eq(index).show();
        $(".ft_on").animate({
            "left":(80*index)+"px"
        },180)
    })

    //多图滚动
    jQuery(" .JD_ms .picScroll-left").slide({titCell:".hd ul",mainCell:".bd ul",autoPage:true,effect:"leftLoop",autoPlay:false,vis:5,trigger:"click",scroll:5,delayTime:600});

    $(".picScroll-left").hover(function(){
        $(".picScroll-left .hd>a").show();
    },function(){
        $(".picScroll-left .hd>a").hide();
    })

//爱生活
    jQuery(".ash .ash_sl .picScroll-left").slide({titCell:" .hd ul",mainCell:" .bd ul",autoPage:true,effect:"leftLoop",autoPlay:false,vis:6,trigger:"click",scroll:6,delayTime:600});

    //电脑数码
    jQuery(".computer .ash_sl .picScroll-left").slide({titCell:" .hd ul",mainCell:" .bd ul",autoPage:true,effect:"leftLoop",autoPlay:false,vis:12,trigger:"click",scroll:12,delayTime:600});
    //爱游戏
    jQuery(".ayx .ash_sl .picScroll-left").slide({titCell:" .hd ul",mainCell:" .bd ul",autoPage:true,effect:"leftLoop",autoPlay:false,vis:4,trigger:"click",scroll:4,delayTime:600});


  //懒加载 20*5
    $(".lazyload img").lazyload({
        placeholder : "grey.gif",
        effect: "fadeIn"
    });

    //吸顶盒显示与隐藏
    $(window).scroll(function(){
        var top = $(this).scrollTop();
        if(top>600){
            $('.fix-top').addClass("fix-dis");
        }else{
            $('.fix-top').removeClass("fix-dis");
        }

    })

    //回到顶部
    $(".totop").click(function(){
        $('body,html').animate({scrollTop:0},500);
    })

    //模拟电梯
    $(window).scroll(function(){
        var top = $(this).scrollTop();
        var con1 = $('.fix-left a:nth-child(1)');
        var con2 = $('.fix-left a:nth-child(2)');
        var con3 = $('.fix-left a:nth-child(3)');
        var con4 = $('.fix-left a:nth-child(4)');
        var con5 = $('.fix-left a:nth-child(5)');
        var con6 = $('.fix-left a:nth-child(6)');
        var con7 = $('.fix-left a:nth-child(7)');
        var con8 = $('.fix-left a:nth-child(8)');
        var con9 = $('.fix-left a:nth-child(9)');

        if(top>1000){
            $('.fix-left').show();
        }else{
            $('.fix-left').hide();
        }
        if(top>1750&&top<2400){
            con1.addClass('current');
        }else{
            con1.removeClass('current');
        }
        if(top>2400&&top<2900){
            con2.addClass('current');
        }else{
            con2.removeClass('current');
        }
        if(top>2900&&top<3500){
            con3.addClass('current');
        }else{
            con3.removeClass('current');
        }
        if(top>=3500&&top<4100){
            con4.addClass('current');
        }else{
            con4.removeClass('current');
        }
        if(top>4100&&top<4600){
            con5.addClass('current');
        }else{
            con5.removeClass('current');
        }
        if(top>4600&&top<5100){
            con6.addClass('current');
        }else{
            con6.removeClass('current');
        }
        if(top>5100&&top<5700){
            con7.addClass('current');
        }else{
            con7.removeClass('current');
        }
        if(top>5700&&top<6400){
            con8.addClass('current');
        }else{
            con8.removeClass('current');
        }
        if(top>6400){
            con9.addClass('current');
        }else{
            con9.removeClass('current');
        }
    })

})
    //模拟电梯
    var myapp = angular.module('myApp',[]);
    myapp.controller('c1',function($scope){
        $scope.arrays=[
            {href:'#pinzhi',con:'享品质'},
            {href:'#life', con:'服饰美妆'},
            {href:'#jiadian', con:'家电手机'},
            {href:'#compu', con:'电脑数码'},
            {href:'#3C', con:'3 C数码'},
            {href:'#eat', con:'爱吃'},
            {href:'#muying', con:'母婴家居'},
            {href:'#book', con:'图书汽车'},
            {href:'#nowan', con:'还没逛够'},
            {href:'#', con:'顶部'}
        ]
    })

